import type { FormSchema } from '@/components/core/schema-form/';

export const schemas: FormSchema[] = [
  {
    field: 'shortName',
    component: 'Input',
    label: '①',
    rules: [{ required: true, type: 'string', message: '请输入消防机构简称' }],
    componentProps: () => {
      return {
        placeholder: '请输入消防机构简称',
      };
    },
  },
  {
    field: 'charName',
    component: 'Input',
    label: '②',
    rules: [{ required: true, message: '请输入记录表字' }],
    componentProps: () => {
      return {
        placeholder: '请输入记录表字',
      };
    },
  },
  {
    field: 'numberName',
    component: 'Input',
    label: '③',
    rules: [{ required: true, message: '请输入记录表号' }],
    componentProps: () => {
      return {
        placeholder: '请输入记录表号',
      };
    },
  },
  {
    field: 'illegalAct',
    component: 'InputTextArea',
    label: '④',
    rules: [{ required: true, message: '请输入违法行为' }],
    componentProps: () => {
      return {
        placeholder: '请输入违法行为',
      };
    },
  },
  {
    field: 'regulation',
    component: 'InputTextArea',
    label: '⑤',
    rules: [{ required: true, message: '请输入法律法规' }],
    componentProps: () => {
      return {
        placeholder: '请输入法律法规',
      };
    },
  },
  {
    field: 'penalty',
    component: 'InputTextArea',
    label: '⑥',
    rules: [{ required: true, message: '请输入罚款内容' }],
    componentProps: () => {
      return {
        placeholder: '请输入罚款内容',
      };
    },
  },
  {
    field: 'executeWay',
    component: 'Select',
    label: '⑦',
    rules: [{ required: true, type: 'number', message: '请选择执行方式' }],
    componentProps: ({ formInstance }) => {
      return {
        placeholder: '请选择执行方式',
        options: [
          {
            label: '警告',
            value: 0,
            key: '1',
          },
          {
            label: '当场收缴罚款',
            value: 1,
            key: '2',
          },
          {
            label: '被处罚人持本决定书在十五日内到银行缴纳罚款',
            value: 2,
            key: '3',
          },
        ],
        onChange: (e: any) => {
          const { updateSchema } = formInstance;
          if (e == 2) {
            updateSchema({
              field: 'bankName',
              vShow: true,
              rules: [{ required: true, message: '请输入银行名称' }],
            });
          } else {
            updateSchema({
              field: 'bankName',
              vShow: false,
            });
          }
        },
      };
    },
  },
  {
    field: 'bankName',
    component: 'Input',
    label: '',
    vShow: false,
    componentProps: () => {
      return {
        placeholder: '请输入银行名称',
      };
    },
  },
  {
    field: 'oranName',
    component: 'Input',
    label: '⑧',
    rules: [{ required: true, message: '请输入机构名称' }],
    componentProps: () => {
      return {
        placeholder: '请输入机构名称',
      };
    },
  },
  {
    field: 'courtName',
    component: 'Input',
    label: '⑨',
    rules: [{ required: true, message: '请输入法院名称' }],
    componentProps: () => {
      return {
        placeholder: '请输入法院名称',
      };
    },
  },
  {
    field: 'info',
    component: 'Input',
    label: '⑩',
    rules: [{ required: true, message: '请输入处罚地点' }],
    componentProps: () => {
      return {
        placeholder: '请输入处罚地点',
      };
    },
  },
];
